Improve S2068 performance: Reuse compiled Regex#8185
Merged
martin-strecker-sonarsource merged 14 commits intomasterfrom Nov 24, 2023
Merged
Improve S2068 performance: Reuse compiled Regex#8185martin-strecker-sonarsource merged 14 commits intomasterfrom
martin-strecker-sonarsource merged 14 commits intomasterfrom
Conversation
|
Kudos, SonarCloud Quality Gate passed! |
|
SonarCloud Quality Gate failed.
|
| private const string MessageUriUserInfo = "Review this hard-coded URI, which may contain a credential."; | ||
| private const string DefaultCredentialWords = "password, passwd, pwd, passphrase"; | ||
| private static readonly ConcurrentDictionary<string, Regex> PasswordValuePattern = new(); | ||
| protected static readonly Regex ValidCredentialPattern = new(@"^(\?|:\w+|\{\d+[^}]*\}|""|')$", RegexOptions.IgnoreCase | RegexOptions.Compiled); |
Contributor
There was a problem hiding this comment.
I've opened #8314 to deal with the timeouts. It should be a small easy change.
analyzers/src/SonarAnalyzer.Common/Rules/Hotspots/DoNotHardcodeCredentialsBase.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Rules/Hotspots/DoNotHardcodeCredentialsBase.cs
Outdated
Show resolved
Hide resolved
pavel-mikula-sonarsource
requested changes
Nov 21, 2023
Contributor
pavel-mikula-sonarsource
left a comment
There was a problem hiding this comment.
We can remove the concurrent dictionary
pavel-mikula-sonarsource
approved these changes
Nov 24, 2023
Contributor
pavel-mikula-sonarsource
left a comment
There was a problem hiding this comment.
LGTM. I'll let you deal with the hotspots before merging (I'm not sure what the correct resolution for hotspots is in the new CaYC QG)
analyzers/src/SonarAnalyzer.Common/Rules/Hotspots/DoNotHardcodeCredentialsBase.cs
Outdated
Show resolved
Hide resolved
…eCredentialsBase.cs Co-authored-by: Pavel Mikula <57188685+pavel-mikula-sonarsource@users.noreply.github.com>
|
Kudos, SonarCloud Quality Gate passed! |
|
Kudos, SonarCloud Quality Gate passed! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.














see also #8181 and #8183
Before:

After:
